module.exports = {
	methods: {
		getElRect(elClass) {
			return new Promise((resolve, reject) => {
				const query = uni.createSelectorQuery().in(this);
				query.select('.' + elClass).fields({
					size: true,
					scrollOffset: true,
					rect: true
				}, res => {
					// 如果节点尚未生成，res值为null，循环调用执行
					if (!res) {
						setTimeout(() => {
							this.getElRect(elClass);
						}, 10);
						return;
					}
					resolve(res);
				}).exec();
			})
		}
	}
}
